package cn.elves.model.uua.endpoint;

import cn.elves.model.entity.dto.response.ResponseDTO;
import org.springframework.security.oauth2.provider.endpoint.FrameworkEndpoint;
import org.springframework.security.oauth2.provider.token.ConsumerTokenServices;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

/**
 * 登出接口
 *
 **/
@FrameworkEndpoint
public class TokenRevokeEndpoint {


    @Resource
    private ConsumerTokenServices tokenService;

    @GetMapping("/invalidate/token")
    public ResponseDTO<String> deleteAccessToken(@RequestParam("accessToken") String accessToken) {
        tokenService.revokeToken(accessToken);
        return ResponseDTO.success();
    }

}


